//
//  GaoToastViewVm.m
//  DuTe
//
//  Created by Gikki Ares on 2020/12/22.
//

#import "JsMessageReminderViewVm.h"
#import "JsColorManager.h"
#import "JsBundleManager.h"

@interface JsMessageReminderViewVm()

{

}
@end


@implementation JsMessageReminderViewVm

+ (JsMessageReminderViewVm *)defaultVm {
	JsMessageReminderViewVm * vm = [JsMessageReminderViewVm new];
	return vm;
}

- (instancetype)init {
	if(self = [super init]) {
		self.dWidth = WRAP_CONTENT;
		self.dHeight = WRAP_CONTENT;
		self.ivLbSpacing = 30;
		self.backgroundColor = [UIColor colorWithWhite:0.5 alpha:1];
		self.cornderRadius = 5;
		self.font = [UIFont systemFontOfSize:16];
		self.mcolor_message = [UIColor whiteColor];
		self.titleColor = [UIColor blackColor];
		self.imageSize = CGSizeMake(60, 60);
		self.mf_imageViewTop = 20;
		self.mf_labelTop = 20;
		self.padding = 10;
	}
	return self;
}

#define imageSize_small 30

/**
 $1 type,代表内容相关性.
 $2,arrangeType,表示元素如何布局
 $3,colorStyle,表示颜色风格.
 0,表示灰色系
 1,表示颜色系
 */
+ (JsMessageReminderViewVm *)vmWithTitle:(NSString *)title contentType:(JsMessageReminderContentType )type arrangeType:(JsMessageReminderArrangeType)arrangeType colorStyle:(JsMessageReminderColorType)colorStyle {
	JsMessageReminderViewVm * vm = [JsMessageReminderViewVm new];
	vm.dWidth = WRAP_CONTENT;
	vm.dHeight = WRAP_CONTENT;
	vm.arrangeStyle = 1;
	vm.imageSize = CGSizeMake(imageSize_small,imageSize_small);
	vm.borderWidth = 1;
	vm.cornderRadius = 5;
	vm.title = title;
	
	NSString * colorDir = @"Reminder/White";
	if(colorStyle == JsMessageReminderColorTypeColor) {
		colorDir = @"Reminder/Color";
	}
	switch(type) {
		default:
		case JsMessageReminderContentTypeTest:{
			vm.backgroundColor = [UIColor redColor];
			UIColor * color2 = [UIColor colorWithHex:0xf5be8f];
			vm.borderColor = color2;
			vm.image = [JsBundleManager iconInBundleNamed:@"info.png" inDir:colorDir];
			break;
		}
		case JsMessageReminderContentTypeInfo:{
			UIColor * color = [UIColor colorWithHex:0xf2fafe];
			vm.backgroundColor = color;
			UIColor * color2 = [UIColor colorWithHex:0xd3eafd];
			vm.borderColor = color2;
			vm.image = [JsBundleManager iconInBundleNamed:@"info.png" inDir:colorDir];
			break;
		}
		case JsMessageReminderContentTypeWarn:{
			vm.imageSize = CGSizeMake(imageSize_small,imageSize_small);
			UIColor * color = [UIColor colorWithHex:0xfef9e8];
			vm.backgroundColor = color;
			UIColor * color2 = [UIColor colorWithHex:0xf9d787];
			vm.borderColor = color2;
			vm.image = [JsBundleManager iconInBundleNamed:@"warn.png" inDir:colorDir];
			break;
		}
		case JsMessageReminderContentTypeError:{
			//https://www.iconfont.cn/search/index?searchType=icon&q=error
			UIColor * color = [UIColor colorWithHex:0xfcede3];
			vm.backgroundColor = color;
			UIColor * color2 = [UIColor colorWithHex:0xe26f4e];
			vm.borderColor = color2;
			vm.image = [JsBundleManager iconInBundleNamed:@"error.png" inDir:colorDir];
			break;
		}
		case JsMessageReminderContentTypeSilent:{
			UIColor * color = [UIColor colorWithHex:0xf2fafe];
			vm.backgroundColor = color;
			UIColor * color2 = [UIColor colorWithHex:0xd3eafd];
			vm.borderColor = color2;
			break;
		}
		case JsMessageReminderContentTypeSuccess:{
			vm.imageSize = CGSizeMake(imageSize_small,imageSize_small);
			UIColor * color = [UIColor colorWithHex:0xf0fef4];
			vm.backgroundColor = color;
			UIColor * color2 = [UIColor colorWithHex:0xa1e3b4];
			vm.borderColor = color2;
			vm.image = [JsBundleManager iconInBundleNamed:@"success.png" inDir:colorDir];
			break;
		}
	}
	return vm;
}



@end
